Count Property (Recipients Collection) 

The Count property returns the number of Recipient objects in the collection. Read-only.

Syntax

objRecipColl.Count

Data Type

Long

Example

This example uses the Count property as a loop counter to copy all recipients from one Recipients collection to another.

' from the sample function Util_CopyMessage

' Copy all Recipient objects from one collection to another

'  ... verify valid message object objOneMsg

   For i = 1 To objOneMsg.Recipients.Count Step 1

        strRecipName = objOneMsg.Recipients.Item(i).Name

        If strRecipName <> "" Then

            Set objOneRecip = objCopyMsg.Recipients.Add

            If objOneRecip Is Nothing Then

                MsgBox "unable to create recipient in message copy"

                Exit Function

            End If

            objOneRecip.Name = strRecipName

        End If

    Next i

 

See Also

Item, Property (Recipients Collection)